package com.hmall.item.config;

import com.hmall.item.Interceptor.MyHandlerInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Description MyWebMvcConfig
 * @Author GGBond
 * @Date 2024-11-16
 */

@Configuration
public class MyWebMvcConfig implements WebMvcConfigurer {

    @Autowired
    private MyHandlerInterceptor myHandlerInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(myHandlerInterceptor).addPathPatterns("/order/**");
        registry.addInterceptor(myHandlerInterceptor).addPathPatterns("/item/**");
        registry.addInterceptor(myHandlerInterceptor).addPathPatterns("/address/**");
        registry.addInterceptor(myHandlerInterceptor).addPathPatterns("/user/**");
    }
}
